package com.cn.thread;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class TestThreadPoolExecutor {
    public static void main(String[] args) {
//        ThreadPoolExecutor threadPool = new ThreadPoolExecutor();
        Executors.newCachedThreadPool();//可以缓存线程池，空闲可以回收
        Executors.newFixedThreadPool(5);//固定并发数，任务超出后队列排队
        Executors.newSingleThreadExecutor();//单线程执行任务，先进先出
        Executors.newScheduledThreadPool(1);//周期性执行
    }
}
